create procedure proc_3
	@Nev nVarChar (30),
	@Megy nVarChar (30),
	@idele nVarChar (30)
As declare 
	@V INT,
	@V1 INT
begin
		set @v = (Select IdeiglenesLerakatokID 
			from IdeiglenesLerakatok i 
		where i.Nev = @idele)
		--insert into Telepulesek values 
		Select @V1 = MAX(TelepulesID)
		From Telepulesek
	if (@V1 is null )
	begin
		Insert into Telepulesek 
		values (1, @Megy, @Nev, @v)
	end
	else
	begin
		Insert into Telepulesek 
		values (@v1+1, @Megy, @Nev, @v)
	end
end
		